﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class MessageService : IMessageService
    {
        public DataSet GetMessageCommandInfoByQueryEntity(MessageCommandQueryEntity messageCommandQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.GetMessageCommandInfoByQueryEntity(messageCommandQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return null;
        }

        public DataSet GetMessageCommandInfoBySqlWhere(List<string> sqlWhere, MessageCommandQueryEntity messageCommandQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.GetMessageCommandInfoByQueryEntity(sqlWhere, messageCommandQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return null;
        }

        public List<MessageCommandInfo> GetMessageCommandInfosByQueryEntity(MessageCommandQueryEntity messageCommandQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.GetMessageCommandInfosByQueryEntity(messageCommandQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return null;
        }

        public List<MessageCommandInfo> GetMessageCommandInfosBySqlWhere(List<string> sqlWhere, MessageCommandQueryEntity messageCommandQuery, PubParasInfo pubParasInfo)
        {
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.GetMessageCommandInfosByQueryEntity(sqlWhere, messageCommandQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return null;
        }

        public string InsertMessageCommandInfo(MessageCommandInfo messageCommandInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.InsertMessageCommand(messageCommandInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return returnStr;
        }

        public bool InsertMessageCommandInfos(List<MessageCommandInfo> messageCommandInfos, PubParasInfo pubParasInfo)
        {
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.InsertMessageCommands(messageCommandInfos);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return false;
        }

        public string UpdateMessageCommandInfo(MessageCommandInfo messageCommandInfo, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                MessageBLL messageBLL = new MessageBLL(pubParasInfo);
                return messageBLL.UpdateMessageCommand(messageCommandInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return returnStr;
        }
    }
}

